xmalloc: add a Kconfig option to poison free pool memory
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 8 Jul 2019 08:31:35 +0000 (10:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 8 Jul 2019 08:31:35 +0000 (10:31 +0200)
commitf0095703890072568db12e9efdc2997070e4e949
tree382a8eb4a837f916836934108cb058c3374f4d37
parentf40785f1500c3728d5a40b4c6c6d46646a87c141
xmalloc: add a Kconfig option to poison free pool memory

This patch adds XMEM_POOL_POISON to the Kconfig DEBUG options. If set,
free blocks (greater than MIN_BLOCK_SIZE) will be poisoned with 0xAA
bytes which will then be verified when memory is subsequently allocated.
This can help in spotting heap corruption, particularly use-after-free.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/Kconfig.debug
xen/common/string.c
xen/common/xmalloc_tlsf.c
xen/include/xen/string.h